package service

import (
	"gitee.com/dayu1985/can_api/service/base"
	"gitee.com/dayu1985/can_api/models/sqlbean"
	"gitee.com/dayu1985/can_api/errors"
)

// 查询分公司
func (this *GroupService) Get(id string) (*sqlbean.Group, error) {
	user := new(sqlbean.Group)
	_, err := this.E.ID(id).Get(user)
	if err != nil {
		return nil, errors.XormSearchErr(err.Error())
	}
	if user.ID == nil {
		return nil, errors.GroupNotFoundErr()
	}
	return user, nil
}

type GroupService struct {
	E *base.Service
}

var groupService *GroupService

func NewGroupService() *GroupService {
	if groupService == nil {
		u := new(GroupService)
		base.RegisterService(u)
		groupService = u
	}
	return groupService
}

func init() {

}
